﻿<%@ Page Language="C#" Trace="false" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="projects.aspx.cs" Inherits="LanguageVersioningPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
	<script>
		function showAddExternalProjectsInterface()
		{
			$('#externalProject').show(0);
			$('#addNewExternalProjectLink').hide(0);
		}
	</script>
	<script>
		function validateNewLocalForm()
		{
			valDisplayer.hideAllValidationErrors();
			var noErrors = true;
			
			var nameElem = $("#<% =  NewProjectNameTxt.ClientID %>");
			var fileNameElem = $("#<% = NewProjectFileNameTxt.ClientID %>");
			if (!nameElem.val())
			{
				valDisplayer.showValidationError("No name specified", nameElem);
				noErrors = false;
			}			
			if (!fileNameElem.val())
			{
				valDisplayer.showValidationError("No file name specified", fileNameElem);
				noErrors = false;
			}
			
			return noErrors;
		}
		
		function validateOpenExternalForm()
		{
			valDisplayer.hideAllValidationErrors();
			var noErrors = true;
			
			var externalPathElem = $("#<% = ExternalProjectFilePathTxt.ClientID %>");
			if (!externalPathElem.val())
			{
				valDisplayer.showValidationError("No path specified", externalPathElem);
				noErrors = false;
			}
			
			return noErrors;
		}
	</script>
	
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="body" Runat="Server">

	<form id="mainForm" runat="server">
		<div class="clearfix">
	
			<div id="intro">
		
				<div class="infoBox" style="margin-bottom: 20px; width: 300px; float: right;">
					<h2 style="margin-top: 0px;">Starting out with SimpleText.NET</h2>
					All functions in the SimpleText.NET administration site works in the context of a project. So the first thing you must do is select or create a project.<br />
					<br />
					<b>Quick start</b><br />
					If you simply want to check out the system, just click the "Sample" link under "Local projects". Otherwise create a new local project from scratch, or enter the path to an external project file.<br />
					<br />
					<b>Using SimpleText for multiple projects</b><br />
					If you are using SimpleText.NET to manage text for multiple sites, you can change project using the quick-menu which is found by clicking the project name in the upper right hand corner. You can always return to this page using the link in the quick-menu, or on the info page.<br />
					<br />
					<b>Local vs External projects</b><br />
					A local project is one that is located in the "App_Data/projects" folder of this site. Local projects are fine for starting out your projects or if you are just taking SimpleText.NET for a test drive.<br />
					<br />
					You will however mostly be using external projects, which lets you point SimpleText at the project file in your site/solution/project folder. This way you keep the SimpleText XML file with the rest of your project files and you can use your version control system to keep track of changes.<br />

				</div>
			</div>
	
		<h1 class="page">Projects</h1>
		
		<p class="pageSection">
			Please select a local or external project, or create a new local project.<br />
		</p>
	
		<h2 class="page">Local projects</h2>
		<div class="pageSection">
			<asp:PlaceHolder id="NoLocalProjectsPlh" visible="false" runat="server">
				<div class="emptyData">none</div>
			</asp:PlaceHolder>
			<asp:PlaceHolder id="LocalProjectsPlh" visible="true" runat="server">
				<asp:Repeater id="LocalProjectsRpt" runat="server">
					<ItemTemplate>
						<a href="?setproject=<%# Server.UrlEncode(Convert.ToString(Eval("FileFullPath"))) %>" title="<%# SimpleTextPage.ShortenPath(Convert.ToString(Eval("FileFullPath")), 50) %>"><%# Eval("ProjectName") %></a><br/>
					</ItemTemplate>
				</asp:Repeater>
			</asp:PlaceHolder>
		</div>

		<h3>Add new project</h3>
		<asp:Panel ID="LoadLocalPanel" DefaultButton="AddNewProjectBtn" runat="server">
			<div class="pageSection">
				<div id="newProject">
					<label for="NewProjectNameTxt">Name</label><br />
					<input class="required" type="text" id="NewProjectNameTxt" name="NewProjectNameTxt" style="width: 200px;" runat="server" /><br />
					<label class="required" for="NewProjectNameTxt">File name</label><br />
					<input type="text" id="NewProjectFileNameTxt" name="NewProjectFileNameTxt" style="width: 200px;" runat="server" /><br />
					<div style="margin-top: 8px;"><asp:Button onclick="AddNewProjectClicked" id="AddNewProjectBtn" Text="Add project" runat="server"></asp:Button></div>
				</div>
			</div>
		</asp:Panel>
			
		<h2 class="page">Recent external projects</h2>
		<div class="pageSection">
			<asp:PlaceHolder id="NoExternalProjectsPlh" visible="false" runat="server">
				<div class="emptyData">none</div>
			</asp:PlaceHolder>
			<asp:PlaceHolder id="ExternalProjectsPlh" visible="true" runat="server">
				<asp:Repeater id="ExternalProjectsRpt" runat="server">
					<ItemTemplate>
						<a href="?setproject=<%# Server.UrlEncode(Convert.ToString(Eval("FileFullPath"))) %>" title="<%# SimpleTextPage.ShortenPath(Convert.ToString(Eval("FileFullPath")), 50) %>"><%# Eval("ProjectName") %></a><br/>
					</ItemTemplate>
				</asp:Repeater>
			</asp:PlaceHolder>
		</div>
			
		<h3>Open another external project</h3>
		<asp:Panel id="LoadExternalPanel" DefaultButton="LoadExternalProjectBtn" runat="server">
			<div class="pageSection">
				<div id="externalProject">
					<asp:PlaceHolder runat="server" visible="true" ID="LoadExternalProjectErrorPlh"><asp:Literal id="LoadExternalProjectErrorLit" runat="server"></asp:Literal></asp:PlaceHolder>
					<label for="ExternalProjectFilePathTxt">Full path <span class="explanatory">(e.g. c:\websites\supersite\www\App_Data\texts.xml)</span></label><br />
					<div><input type="text" id="ExternalProjectFilePathTxt" name="ExternalProjectFilePathTxt" style="width: 400px;" runat="server" /></div>
					<div style="margin-top: 4px;"><asp:Button id="LoadExternalProjectBtn" onclick="LoadExternalProjectClicked" Text="Load project" runat="server"></asp:Button></div>
				</div>
				
			</div>
		</asp:Panel>


		</div>
	</form>

</asp:Content>
